package com.situ.day9;

import org.junit.Test;

public class Erweishuzu {
	@Test
	public void test (){
		String[][] names={{"tom","jack","mike"},{"zhangsan","lisi","wangwu"}};
		for (int i = 0; i < names.length; i++) {
			for (int j = 0; j < names[i].length; j++) {
				System.out.println(names[i][j]);
			}
			System.out.println();
		}
	}
	
	@Test
	public void test1(){
//		int[][] array = new int[3][];
//		array[0] = new int[3];
//		array[1] = new int[1];
//		array[2] = new int[5];
//		array[0][0] = 1;
//		array[0][1] = 2;
//		array[0][2] = 1;
//		array[1][0] = 2;
//		array[2][0] = 5;
//		array[2][1] = 6;
//		array[2][2] = 7;
//		array[2][3] = 8;
//		array[2][4] = 9;
		int[][] array = {{1,2,},{1,2,33,34,5,6},{1,4},{3,7,5,4,},{4,5,3}};
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}
	
	
	@Test 						//冒泡排序
	public void test3(){
		int[] array = {34,23,54,12,9,66,21,56,3};
		for (int i = 1; i < array.length; i++) {		 //外层控制比较多少轮
			for (int j = 0; j < array.length - 1; j++) { //内层控制一轮比较多少次
				if (array[j] > array[j + 1]) {	
					int temp = array[j];
					array[j] = array[j + 1];
					array[j + 1] = temp;
				}
			}
		}
		for (int i = 0; i < array.length; i++) {
			System.out.print(array[i] + " ");
		}
	}
}
